import { Component, OnInit } from '@angular/core';
import { Input } from '@angular/core';
import { TestFormModel } from './test-form-model';
import { CusHttpServService } from '../cus-http-serv.service';
import {StoreService} from '../store-service';
@Component({
  selector: 'app-scomp',
  templateUrl: './scomp.component.html',
  // styleUrls: ['./scomp.component.css']
  styleUrls: ['./scomp.component.scss']
})
export class ScompComponent implements OnInit {
  // httpServ: CusHttpServService;
  @Input() tsNum: Number;
  // form = new TestFormModel('' ,'')
  form = new Object()
  constructor(private httpServ: CusHttpServService,
    private store: StoreService) { }

  ngOnInit() {
  }
  // imports: [FormsModule]
  showParam () {
    console.log('form', this.form)
  }
  sendHttpGetTest () {
    // 返回 str 示例
    this.httpServ.get('/test/tf', { responseType: 'text' }).subscribe(rlt => console.log('rlt: ', rlt))
  }
  postTestData () {
    let data = {
      "1": "I am",
      "2": "what i am",
      "3": 3,
      "4": new Date()
    }
    this.httpServ.post('/test/ng-post-test', data).subscribe((rlt: any) => console.log('post rlt', rlt.data))
  }
}
